<template>
  <div class="search">
    <Card>
      <Row @keydown.enter.native="handleSearch">
        <Form
          ref="searchForm"
          :model="searchForm"
          inline
          :label-width="75"
          class="search-form"
        >
          <Form-item label="区域" prop="name">
            <region style="width: 350px" @selected="selectedRegion" />
          </Form-item>
          <Button
            @click="handleSearch"
            class="search-btn"
            type="primary"
            icon="ios-search"
            >搜索</Button
          >
        </Form>
      </Row>
      <Table
        :loading="loading"
        border
        :columns="columns"
        class="mt_10"
        :data="data"
        ref="table"
      ></Table>
      <Row type="flex" justify="end" class="mt_10">
        <Page
          :current="searchForm.pageNumber"
          :total="total"
          :page-size="searchForm.pageSize"
          @on-change="changePage"
          @on-page-size-change="changePageSize"
          :page-size-opts="[10, 20, 50, 100]"
          size="small"
          show-total
          show-elevator
          show-sizer
        ></Page>
      </Row>
    </Card>
  </div>
</template>

<script>
import { getFinancialFund } from "@/api/financial.js";
import region from "@/views/agent-manage/region";

export default {
  name: "BSummary",
  components: {
    region,
  },
  data() {
    return {
      loading: true, // 表单加载状态
      searchForm: {
        // 请求参数
        pageNumber: 1,
        pageSize: 10,
        order: "desc",
        region: "",
        regionId: "",
      },
      columns: [
        {
          title: "序号",
          key: "name",
          tooltip: true,
        },
        {
          title: "商企/店铺名称",
          key: "nameTypeText",
        },
        {
          title: "注册手机号",
          key: "busTypeText",
        },

        {
          title: "商品名称",
          align: "left",
          key: "changeDetails",
        },
        {
          title: "规格",
          align: "left",
          key: "changeAmount",
        },
        {
          title: "销售数量",
          align: "left",
          key: "creditPeriod",
        },
        {
          title: "销售单价",
          align: "left",
          key: "creditPeriod",
        },
        {
          title: "销售总额",
          align: "left",
          key: "creditPeriod",
        },
       
        {
          title: "提现折扣比例",
          align: "left",
          key: "creditPeriod",
        },
        {
          title: "已提现金额(人民币:元)",
          align: "left",
          key: "creditPeriod",
        },
         {
          title: "焕贝余额",
          align: "left",
          key: "creditPeriod",
        },
         {
          title: "应提现金额",
          align: "left",
          key: "creditPeriod",
        },
        {
          title: "备注",
          align: "left",
          key: "creditPeriod",
        },
      ],
      data: [], // 表单数据
      total: 0, // 表单数据总数
    };
  },
  methods: {
    // 选中的地址
    selectedRegion(val) {
      this.searchForm.region = val[1];
      this.searchForm.regionId = val[0];
    },
    // 分页 改变页码
    changePage(v) {
      this.searchForm.pageNumber = v;
      this.getData();
    },
    // 分页 改变页数
    changePageSize(v) {
      this.searchForm.pageSize = v;
      this.searchForm.pageNumber = 1;
      this.getData();
    },
    // 搜索
    handleSearch() {
      this.searchForm.pageNumber = 1;
      this.searchForm.pageSize = 10;
      this.getData();
    },
    //查询会员列表
    getData() {
      getFinancialFund(this.searchForm).then((res) => {
        if (res.result.records) {
          this.loading = false;
          // this.data = res.result.records;
          this.data = [];
          this.total = res.result.total;
        }
      });
    },
  },
  mounted() {
    this.getData();
  },
};
</script>
<style lang="scss" scoped>
/deep/ .ivu-table-wrapper {
  width: 100%;
}
/deep/ .ivu-card {
  width: 100%;
}
.face {
  width: 60px;
  height: 60px;
  border-radius: 50%;
}

.item {
  width: 350px !important;
  display: flex;

  > * {
    margin: 0 4px;
  }
}
</style>
